import axios, {ResponseData} from 'yuxin-base/src/utils/axios'
/**
 * pms开票历史列表
 * @param
 */
export const invoicingListF = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/invoicing/pages',
		data,
		method: 'POST'
	})
}

/**
 * pms开票列表审批状态统计
 * @param
 */
export const invoicingCounts = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/invoicing/counts',
		data,
		method: 'POST'
	})
}

/**
 * pms开票详情
 * @param
 */
export const invoicingDetails = (id: string): Promise<ResponseData> => {
	return axios.request({
		url: `/finance/invoice/invoicing/detail/${id}`,
		method: 'GET'
	})
}

/**
 * pms开票作废
 * @param
 */
export const invoicingNullify = (id: string): Promise<ResponseData> => {
	return axios.request({
		url: `/finance/invoice/invoicing/nullify/${id}`,
		method: 'GET'
	})
}

/**
 * pms撤销发票
 * @param
 */
export const invoicingRevoke = (invoiceInfoId: string): Promise<ResponseData> => {
	return axios.request({
		url: `/finance/invoice/invoicing/revoke/${invoiceInfoId}`,
		method: 'GET'
	})
}
/**
 * pms发起冲红
 * @param
 */
export const invoicingRedF = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/invoicing/red',
		data,
		method: 'POST'
	})
}

/**
 * pms发起冲红补录
 * @param
 */
export const historicalInvoicingRedF = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/historical/invoicing/red',
		data,
		method: 'POST'
	})
}

/**
 * pms查询结果
 * @param
 */
export const updateQueryResults = (orgItemId: string) => {
	return axios.request({
		url: `/finance/invoice/invoicing/spi/sync_info/${orgItemId}`,
		method: 'GET'
	})
}

//重新提交冲红
export const resubmitRedInvoicing = (data: object) => {
	return axios.request({
		url: '/finance/invoice/invoicing/red/resubmit',
		data,
		method: 'POST'
	})
}

//重新提交补录冲红
export const historicalRedEdit = (data: object) => {
	return axios.request({
		url: '/finance/invoice/historical/invoicing/red_edit',
		data,
		method: 'POST'
	})
}

// 重新推送
export const rePushF = (invoiceId: string) => {
	return axios.request({
		url: `/finance/invoice/invoicing/spi/sync_info/${invoiceId}`,
		method: 'GET'
	})
}

// 重新开票
export const resubmitInvoicing = (data: object) => {
	return axios.request({
		url: '/finance/invoice/invoicing/blue/resubmit',
		data,
		method: 'POST'
	})
}

// 补录重新开票
export const historicalBlueEdit = (data: object) => {
	return axios.request({
		url: '/finance/invoice/historical/invoicing/blue_edit',
		data,
		method: 'POST'
	})
}

//修改email
export const updateEmail = (data: object) => {
	return axios.request({
		url: '/finance/invoice/invoicing/update_taker_info',
		data,
		method: 'POST'
	})
}

//获取发票明细
export const getInvoiceDetails = (invoiceId: string) => {
	return axios.request({
		url: `/finance/invoice/invoicing/invoice_detail/${invoiceId}`,
		method: 'GET'
	})
}

/**
 * 审批撤销
 * @param data
 */
export const approvalRevoke = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/workflow/custom/approval/revoke',
		data,
		method: 'POST'
	})
}

// 重新推送
export const rePushAgain = (invoiceId: string) => {
	return axios.request({
		url: `/finance/invoice/invoicing/invoice_repush/${invoiceId}`,
		method: 'GET'
	})
}

//确认冲红
export const confirmFlushing = (data: object) => {
	return axios.request({
		url: '/finance/invoice/invoicing/red/confirm',
		data,
		method: 'POST'
	})
}

// 补录发票删除
export const historicalBlueDel = (invOrgItemId: string) => {
	return axios.request({
		url: `/finance/invoice/historical/invoicing/blue_del/${invOrgItemId}`,
		method: 'DELETE'
	})
}

// 补录冲红删除
export const historicalRedDel = (invOrgItemId: string) => {
	return axios.request({
		url: `/finance/invoice/historical/invoicing/red_del/${invOrgItemId}`,
		method: 'DELETE'
	})
}
/**
 * 租客端发票处理
 * @param data
 * @returns
 */
export const approvalHandle = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/invoicing/prev/handle/approval',
		data,
		method: 'POST'
	})
}
